package com.qcq.wecheck.entity;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 * 签到记录表
 * </p>
 *
 * @author O
 * @since 2018-09-19
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class Attendance extends Model<Attendance> {

	private static final long serialVersionUID = 1L;

	/**
	 * 主键
	 */
	@TableId(value = "id", type = IdType.AUTO)
	private Long id;
	/**
	 * 签到人的openId
	 */
	@TableId("open_id")
	@NotEmpty(message = "openId不能为空")
	private String openId;
	/**
	 * 对应哪张签到表
	 */
	@TableField("schedule_id")
	@NotNull(message = "scheduleId不能为空")
	private Long scheduleId;
	/**
	 * 签到时间
	 */
	@TableField("check_time")
	@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
	private LocalDateTime checkTime;


	@Override
	protected Serializable pkVal() {
		return this.openId;
	}

}
